<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>类的继承</title>
	<script type="text/javascript">
		
		function Fclass(name,age){
			this.name = name;
			this.age = age;
		}

		Fclass.prototype.showname = function(){
			alert(this.name);
		}

		Fclass.prototype.showage = function(){
			alert(this.age);
		}


		// 属性用call或者applay的方式来继承

		function Sclass(name,age,job){

			Fclass.call(this,name,age);

			this.job = job;			
		}


		// 方法继承：将父类的一个实例赋值给子类的原型属性
		Sclass.prototype = new Fclass();

		Sclass.prototype.showjob = function(){

			alert(this.job);

		}


		var Tom = new Sclass('tom',18,'engineer');


		Tom.showname();
		Tom.showage();
		Tom.showjob();




	</script>
</head>
<body>
	
</body>
</html>